Release 10.1A: OpenEdge Development:
ProDataSets
Creating a dynamic Data-Source
Because a ProDataSet and a Data-Source are independent objects, there is no need to create dynamic Data-Source objects for a dynamic ProDataSet. If you have static Data-Sources available, you can attach them to a dynamic ProDataSet handle just as easily as you can to a static ProDataSet handle. For example, you could have something in the way of a collection of static Data-Source definitions for a set of database tables, but have a procedure that assembled those tables in a variety of ways into various dynamic ProDataSets. The Data-Source definitions could be static, and the ProDataSet definition dynamic.
You can also create a dynamic Data-Source when you need one. You can attach a dynamic Data-Source to either a static or dynamic ProDataSet. You use this statement to create a dynamic Data-Source:
Like other database objects, the dynamic Data-Source is created in the closest unnamed widget-pool unless the
IN WIDGET-POOLphrase is used. It is automatically deleted when the widget-pool is deleted. If there is noWIDGET-POOLphrase and no localCREATE WIDGET-POOLstatement, then it will go into the session’s unnamed widget pool. In this latter case, it must be deleted specifically, using theDELETE OBJECTstatement. By contrast, a static Data-Source is automatically deleted when the procedure it is defined in is destroyed.When you create a dynamic Data-Source, you get a handle and an empty structure to fill in. You can then associate a query with the dynamic Data-Source by setting its
QUERYattribute, as shown in the following syntax:
To disassociate the query and Data-Source, set the
QUERYattribute to the Unknown value (?):
Just like a static Data-Source, a dynamic Data-Source must have a set of buffers that can be deduced from the query, or you can supply them separately from the query.
The
ADD-SOURCE-BUFFERmethod lets you build up a Data-Source at run time:
In this method:
buffer-handleis the handle of a database buffer, or a temp-table buffer that you want to use as a Data-Source for a temp-table in a ProDataSet.key-fieldsis a character expression that evaluates to a comma-separated list of key component fields for finding a record using the buffer, just as in theKEYSphrase in the staticDEFINE DATA-SOURCEstatement. This argument can be passed as the Unknown value (?) when Progress can deduce a unique primary key based on the index definitions for the table, or when the Data-Source will not be used for updates, and therefore a unique key is not needed.As with ProDataSets, you cannot use the
ADD-SOURCE-BUFFERmethod to add a buffer to a static Data-Source dynamically. TheDEFINE DATA-SOURCEstatement must contain the complete definition of the static Data-Source.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |